package cn.lizhangqu.kb.activity;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ExpandableListView;
import android.widget.TextView;

import java.util.List;

import cn.lizhangqu.kb.R;
import cn.lizhangqu.kb.adapter.ScoreExpandableListAdapter;
import cn.lizhangqu.kb.model.Score;
import cn.lizhangqu.kb.service.ScoreService;

/**
 * Created by 柯尊诚 on 2015/11/3.
 * kzc
 */
public class ScoreActivity extends Activity{

    private TextView scoreTv;
    String result = null;

    private ExpandableListView scoreListView;
    private ScoreExpandableListAdapter scoreAdapter;
    private List<Score> scores;
    private ScoreService scoreService;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score);

        init();
        Log.d("xxxx>", scoreService.findAll().size() + "");
        scores = scoreService.findAll();
        scoreAdapter = new ScoreExpandableListAdapter(this, scores);
        scoreListView.setAdapter(scoreAdapter);
    }

    private void init() {
        scoreService = ScoreService.getScoreService();
        scoreListView = (ExpandableListView) findViewById(R.id.score_expandableListView);

    }
}
